package com.dinghui.salary.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.dinghui.salary.pojo.User;
import com.dinghui.salary.pojo.dto.SearchSalaryDTO;
import com.dinghui.salary.pojo.vo.StatisticsVO;
import com.dinghui.salary.pojo.vo.YearMonthStatisticsVO;
import com.dinghui.salary.pojo.vo.YearStatisticsVO;
import com.dinghui.salary.service.SalaryService;
import com.dinghui.salary.service.SalaryStatisticsService;
import com.dinghui.salary.utils.ApiResult;
import com.dinghui.salary.utils.LocalUser;
import com.dinghui.salary.utils.PagedGridResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.objects.annotations.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author tanrentao
 * @date 2021-09-10
 * @desc 工资统计
 */
@RestController
@RequestMapping("/salaryStatistics")
@Api(value = "SalaryStatisticsController", tags = "工资统计")
public class SalaryStatisticsController {

    @Reference(version = "2.0.0")
    SalaryStatisticsService salaryStatisticsService;

    @ApiOperation("按照年月统计工资总数")
    @GetMapping("/getSalaryStatisticsByYearAndMonth")
    public ApiResult getSalaryStatisticsByYearAndMonth() {
        List<StatisticsVO> list =  salaryStatisticsService.getSalaryStatisticsByYearAndMonth();
        return ApiResult.success(list);
    }

    @ApiOperation("按照年统计工资总数")
    @GetMapping("/getSalaryStatisticsByYear")
    public ApiResult getSalaryStatisticsByYear() {
        List<YearStatisticsVO> list  = salaryStatisticsService.getSalaryStatisticsByYear();
        return ApiResult.success(list);
    }


}
